//
//  ILDailySelectTableViewCell.m
//  ILife
//
//  Created by lanou on 15/10/26.
//  Copyright © 2015年 ILife. All rights reserved.
//

#import "ILDailySelectTableViewCell.h"
#import <UIImageView+WebCache.h>


@implementation ILDailySelectTableViewCell



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
  self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.coverImgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,SCREEN_WIDTH, 777*SCREEN_WIDTH/1242)];
        
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, ((SCREEN_HEIGHT-80)/2 -50)/2-30, SCREEN_WIDTH, 30)];
        
        self.category_durLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, ((SCREEN_HEIGHT-80)/2 -50)/2,SCREEN_WIDTH, 20)];
        
        
        
        [self.contentView addSubview:_coverImgView];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_category_durLabel];

        
    }
    return self;
}



-(void)setDailySelectModel:(ILDailySelectModel*)model
{
    _dailySelectModel = model;
    [self.coverImgView sd_setImageWithURL:[NSURL URLWithString:model.coverForDetail]placeholderImage:[UIImage imageNamed:@"ilife"]];
    self.titleLabel.text = model.title;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleLabel.textColor = [UIColor whiteColor];
    
    NSInteger hour = model.duration/60;
    NSInteger min = model.duration%60;
    NSString *str = [NSString stringWithFormat:@"/%ld'%ld''",hour,min];
   
    self.category_durLabel.text = [[NSString stringWithFormat:@"#%@",model.category]stringByAppendingString:str];
    self.category_durLabel.font = [UIFont systemFontOfSize:12];
    self.category_durLabel.textAlignment = NSTextAlignmentCenter;
    self.category_durLabel.textColor = [UIColor whiteColor];
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
